# encoding: utf-8
import gitlab
import sys

# 声明 gitlab 实例，采用private_token的形式来实现连接
gl = gitlab.Gitlab('http://88.128.18.112：8080', private_token='FFbQs12313123eauof_EpVmaPcz')

# 打开本地文件
f = open(r"/Users/xxxx/WorkSpace/temp/test/users.txt", "r")
line = f.readline()
while line:
    # 分割每一行
    temp = line.split(" ")
    password = temp[0].decode('ascii', 'ignore').encode('utf-8')
    email = temp[1]
    username = temp[2]
    name = temp[3]
    user_data = {'email': email, 'username': username, 'name': name, 'password': password}
    user = gl.users.create(user_data)
    print(user)
    line = f.readline()
f.close()
